#ifndef SEMANTICNODEVARIABLENAME_H_
#define SEMANTICNODEVARIABLENAME_H_

#include "SemanticNode.h"
#include "ValueType.h"
#include <string>
#include <vector>

extern MainContainer *CompilerData;

class SemanticNodeExpression;

class SemanticNodeVariableName : public SemanticNode, public ValueType {
private:
	/** Izravnata imena varijabli. */
	std::vector<std::vector<std::string> > flatNames;
	/** Koordinate elemenata polja koji se dohvacaju. */
	std::vector<std::vector<SemanticNodeExpression *> > dimensions;
	/** Pokazivaci na sintaksne nodove koji su koordinate elemenata polja koji se dohvacaju. */
	std::vector<std::vector<const SyntaxTreeNode *> > expressions;

	std::vector<std::string> flattenNameAmbiguous(const SyntaxTreeNode *nameAmbiguousNode);

	friend SyntaxTreeNode *copyNode(const SyntaxTreeNode *aNode, SyntaxTreeNode *parent);

public:
	SemanticNodeVariableName(const SyntaxTreeNode *variableNameNode, SemanticNode *parent);

	std::vector<const SyntaxTreeNode *> findVVs(const SyntaxTreeNode *rootVV);
	std::vector<std::vector<const SyntaxTreeNode *> > getExpressions();
	void addExpression(SemanticNodeExpression *expr, int x, int y);

	virtual std::string toDebugString(int tab);
	// temporary
	std::string convDebug(int tab, const SyntaxTreeNode &node);
};

#endif
